package com.scott.controller;

import com.scott.dubbo.service.CalService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.dubbo.config.annotation.Reference;

@RestController
public class UserController {


    @Reference
    private CalService service;

    // http://localhost:8080/add?x=10&y=20
    @GetMapping("/add")
    public Integer add(@RequestParam("x") Integer x, @RequestParam("y") Integer y){

        System.out.println("-----------");
        Integer sum = service.add(x,y);
        return sum;
    }
}
